home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / dev / gui / DesignerV1_53.lha / Designer / ShowIconDemo / ShowIconDemo.c < prev    next >
C/C++ Source or Header  |  1995-04-28  |  2KB  |  82 lines

  1. /* Compile me to get full executable. */
  2.  
  3. #include <stdio.h>
  4. #include <workbench/startup.h>
  5. #include "showicondemowin.c"
  6.  
  7. int main(void)
  8. {
  9. int done=0;
  10. ULONG class;
  11. UWORD code;
  12. ULONG appid=1;
  13. struct Gadget *pgsel;
  14. struct IntuiMessage *imsg;
  15. struct AppMessage *appmsg;
  16. struct MsgPort *appport;
  17. UBYTE  Buffer[250];
  18.  
  19. if (OpenLibs()==0)
  20.     {
  21.     if (appport=CreateMsgPort())
  22.         {
  23.         if (OpenWindowWin0(appport,appid)==0)
  24.             {
  25.             while(done==0)
  26.                 {
  27.                 
  28.                 Wait( (1L << Win0->UserPort->mp_SigBit) | (1L << appport->mp_SigBit) );
  29.                 
  30.                 imsg=GT_GetIMsg(Win0->UserPort);
  31.                 while (imsg != NULL )
  32.                     {
  33.                     class=imsg->Class;
  34.                     code=imsg->Code;
  35.                     pgsel=(struct Gadget *)imsg->IAddress; /* Only reference if it is a gadget message */
  36.                     GT_ReplyIMsg(imsg);
  37.                     if (class==IDCMP_CLOSEWINDOW)
  38.                         done=1;
  39.                     if (class==IDCMP_REFRESHWINDOW)
  40.                         {
  41.                         GT_BeginRefresh(Win0);
  42.                         GT_EndRefresh(Win0, TRUE);
  43.                         }
  44.                     imsg=GT_GetIMsg(Win0->UserPort);
  45.                     }
  46.                 
  47.                 /* Process appwindow messages */
  48.                 
  49.                 while (appmsg=(struct AppMessage *)GetMsg(appport))
  50.                     {
  51.                     
  52.                     printf("File = %s\n",appmsg->am_ArgList->wa_Name);
  53.                     
  54.                     NameFromLock( appmsg->am_ArgList->wa_Lock , Buffer , 250);
  55.                     
  56.                     printf("Dir  = %s\n", Buffer);
  57.                     
  58.                     ReplyMsg( (struct Message *) appmsg);
  59.                     }
  60.                 
  61.                 }
  62.             
  63.             CloseWindowWin0();
  64.             }
  65.         else
  66.             printf("Cannot open window.\n");
  67.     
  68.         /* Clear message port before closing */
  69.         
  70.         while (appmsg=(struct AppMessage *)GetMsg(appport))
  71.             ReplyMsg( (struct Message *) appmsg);
  72.         
  73.         DeleteMsgPort(appport);
  74.         }
  75.     else
  76.         printf("Cannot create msg port.\n");
  77.     CloseLibs();
  78.     }
  79. else
  80.     printf("Cannot open libraries.\n");
  81. }
  82.